1 Setup

First, we set up our workspace. Load maftools to analyze the maf files.

Get all the mafs and merge them into one big maf.

library(maftools)
library(tidyverse)
library(synapser)
synLogin()
## Welcome, Robert Allaway!
## NULL
child <- synGetChildren('syn35817148')$asList()
ids <- map(child, "id") %>% unlist()

maf_paths <- lapply(ids, synGet)
## 
Downloading  [####----------------]21.78%   8.0MB/36.7MB (1008.9kB/s) DeepVariant_28cNF.vep.maf.synapse_download_102759034     
Downloading  [#########-----------]43.57%   16.0MB/36.7MB (2.0MB/s) DeepVariant_28cNF.vep.maf.synapse_download_102759034     
Downloading  [###########---------]56.43%   20.7MB/36.7MB (2.6MB/s) DeepVariant_28cNF.vep.maf.synapse_download_102759034     
Downloading  [################----]78.22%   28.7MB/36.7MB (3.5MB/s) DeepVariant_28cNF.vep.maf.synapse_download_102759034     
Downloading  [####################]100.00%   36.7MB/36.7MB (4.5MB/s) DeepVariant_28cNF.vep.maf.synapse_download_102759034 Done...    
Downloading  [####----------------]21.25%   8.0MB/37.7MB (612.1kB/s) DeepVariant_cNF00.10a.vep.maf.synapse_download_102758837     
Downloading  [########------------]42.50%   16.0MB/37.7MB (1.2MB/s) DeepVariant_cNF00.10a.vep.maf.synapse_download_102758837     
Downloading  [#############-------]63.74%   24.0MB/37.7MB (1.8MB/s) DeepVariant_cNF00.10a.vep.maf.synapse_download_102758837     
Downloading  [################----]78.75%   29.7MB/37.7MB (2.2MB/s) DeepVariant_cNF00.10a.vep.maf.synapse_download_102758837     
Downloading  [####################]100.00%   37.7MB/37.7MB (2.8MB/s) DeepVariant_cNF00.10a.vep.maf.synapse_download_102758837 Done...    
Downloading  [####----------------]20.92%   8.0MB/38.2MB (420.2kB/s) DeepVariant_cNF04.9a.vep.maf.synapse_download_102758839     
Downloading  [#######-------------]37.23%   14.2MB/38.2MB (747.5kB/s) DeepVariant_cNF04.9a.vep.maf.synapse_download_102758839     
Downloading  [############--------]58.15%   22.2MB/38.2MB (1.1MB/s) DeepVariant_cNF04.9a.vep.maf.synapse_download_102758839     
Downloading  [################----]79.08%   30.2MB/38.2MB (1.6MB/s) DeepVariant_cNF04.9a.vep.maf.synapse_download_102758839     
Downloading  [####################]100.00%   38.2MB/38.2MB (2.0MB/s) DeepVariant_cNF04.9a.vep.maf.synapse_download_102758839 Done...    
Downloading  [####----------------]22.39%   8.0MB/35.7MB (556.5kB/s) DeepVariant_cNF97.2a.vep.maf.synapse_download_102758840     
Downloading  [#######-------------]32.82%   11.7MB/35.7MB (815.3kB/s) DeepVariant_cNF97.2a.vep.maf.synapse_download_102758840     
Downloading  [###########---------]55.21%   19.7MB/35.7MB (1.3MB/s) DeepVariant_cNF97.2a.vep.maf.synapse_download_102758840     
Downloading  [################----]77.61%   27.7MB/35.7MB (1.9MB/s) DeepVariant_cNF97.2a.vep.maf.synapse_download_102758840     
Downloading  [####################]100.00%   35.7MB/35.7MB (2.4MB/s) DeepVariant_cNF97.2a.vep.maf.synapse_download_102758840 Done...    
Downloading  [###-----------------]14.49%   5.4MB/37.4MB (452.7kB/s) DeepVariant_cNF97.2b.vep.maf.synapse_download_102758843     
Downloading  [#######-------------]35.87%   13.4MB/37.4MB (1.1MB/s) DeepVariant_cNF97.2b.vep.maf.synapse_download_102758843     
Downloading  [###########---------]57.24%   21.4MB/37.4MB (1.7MB/s) DeepVariant_cNF97.2b.vep.maf.synapse_download_102758843     
Downloading  [################----]78.62%   29.4MB/37.4MB (2.4MB/s) DeepVariant_cNF97.2b.vep.maf.synapse_download_102758843     
Downloading  [####################]100.00%   37.4MB/37.4MB (3.0MB/s) DeepVariant_cNF97.2b.vep.maf.synapse_download_102758843 Done...    
Downloading  [####----------------]20.85%   8.0MB/38.4MB (595.7kB/s) DeepVariant_cNF98.4c.vep.maf.synapse_download_102758845     
Downloading  [#######-------------]37.45%   14.4MB/38.4MB (1.0MB/s) DeepVariant_cNF98.4c.vep.maf.synapse_download_102758845     
Downloading  [############--------]58.30%   22.4MB/38.4MB (1.6MB/s) DeepVariant_cNF98.4c.vep.maf.synapse_download_102758845     
Downloading  [################----]79.15%   30.4MB/38.4MB (2.2MB/s) DeepVariant_cNF98.4c.vep.maf.synapse_download_102758845     
Downloading  [####################]100.00%   38.4MB/38.4MB (2.8MB/s) DeepVariant_cNF98.4c.vep.maf.synapse_download_102758845 Done...    
Downloading  [##------------------]9.33%   3.3MB/35.3MB (241.1kB/s) DeepVariant_cNF98.4d.vep.maf.synapse_download_102758846     
Downloading  [######--------------]32.00%   11.3MB/35.3MB (826.3kB/s) DeepVariant_cNF98.4d.vep.maf.synapse_download_102758846     
Downloading  [###########---------]54.67%   19.3MB/35.3MB (1.4MB/s) DeepVariant_cNF98.4d.vep.maf.synapse_download_102758846     
Downloading  [###############-----]77.33%   27.3MB/35.3MB (1.9MB/s) DeepVariant_cNF98.4d.vep.maf.synapse_download_102758846     
Downloading  [####################]100.00%   35.3MB/35.3MB (2.5MB/s) DeepVariant_cNF98.4d.vep.maf.synapse_download_102758846 Done...    
Downloading  [####----------------]21.11%   8.0MB/37.9MB (438.9kB/s) DeepVariant_i28cNF.vep.maf.synapse_download_102758849     
Downloading  [########------------]42.21%   16.0MB/37.9MB (877.6kB/s) DeepVariant_i28cNF.vep.maf.synapse_download_102758849     
Downloading  [#############-------]63.32%   24.0MB/37.9MB (1.3MB/s) DeepVariant_i28cNF.vep.maf.synapse_download_102758849     
Downloading  [################----]78.89%   29.9MB/37.9MB (1.6MB/s) DeepVariant_i28cNF.vep.maf.synapse_download_102758849     
Downloading  [####################]100.00%   37.9MB/37.9MB (2.0MB/s) DeepVariant_i28cNF.vep.maf.synapse_download_102758849 Done...    
Downloading  [####----------------]20.44%   8.0MB/39.1MB (630.8kB/s) DeepVariant_icNF00.10a.vep.maf.synapse_download_102759036     
Downloading  [########------------]40.88%   16.0MB/39.1MB (1.2MB/s) DeepVariant_icNF00.10a.vep.maf.synapse_download_102759036     
Downloading  [############--------]59.12%   23.1MB/39.1MB (1.8MB/s) DeepVariant_icNF00.10a.vep.maf.synapse_download_102759036     
Downloading  [################----]79.56%   31.1MB/39.1MB (2.4MB/s) DeepVariant_icNF00.10a.vep.maf.synapse_download_102759036     
Downloading  [####################]100.00%   39.1MB/39.1MB (3.0MB/s) DeepVariant_icNF00.10a.vep.maf.synapse_download_102759036 Done...    
Downloading  [####----------------]22.35%   8.0MB/35.8MB (803.8kB/s) DeepVariant_icNF04.9a.vep.maf.synapse_download_102759038     
Downloading  [#######-------------]32.95%   11.8MB/35.8MB (1.2MB/s) DeepVariant_icNF04.9a.vep.maf.synapse_download_102759038     
Downloading  [###########---------]55.30%   19.8MB/35.8MB (1.9MB/s) DeepVariant_icNF04.9a.vep.maf.synapse_download_102759038     
Downloading  [################----]77.65%   27.8MB/35.8MB (2.7MB/s) DeepVariant_icNF04.9a.vep.maf.synapse_download_102759038     
Downloading  [####################]100.00%   35.8MB/35.8MB (3.5MB/s) DeepVariant_icNF04.9a.vep.maf.synapse_download_102759038 Done...    
Downloading  [####----------------]18.70%   8.0MB/42.8MB (627.6kB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040     
Downloading  [#######-------------]37.40%   16.0MB/42.8MB (1.2MB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040     
Downloading  [#########-----------]43.89%   18.8MB/42.8MB (1.4MB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040     
Downloading  [#############-------]62.60%   26.8MB/42.8MB (2.1MB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040     
Downloading  [################----]81.30%   34.8MB/42.8MB (2.7MB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040     
Downloading  [####################]100.00%   42.8MB/42.8MB (3.3MB/s) DeepVariant_icNF97.2a.vep.maf.synapse_download_102759040 Done...    
Downloading  [####----------------]21.42%   8.0MB/37.4MB (515.9kB/s) DeepVariant_icNF97.2b.vep.maf.synapse_download_102759041     
Downloading  [#######-------------]35.75%   13.4MB/37.4MB (861.2kB/s) DeepVariant_icNF97.2b.vep.maf.synapse_download_102759041     
Downloading  [###########---------]57.17%   21.4MB/37.4MB (1.3MB/s) DeepVariant_icNF97.2b.vep.maf.synapse_download_102759041     
Downloading  [################----]78.58%   29.4MB/37.4MB (1.8MB/s) DeepVariant_icNF97.2b.vep.maf.synapse_download_102759041     
Downloading  [####################]100.00%   37.4MB/37.4MB (2.4MB/s) DeepVariant_icNF97.2b.vep.maf.synapse_download_102759041 Done...    
Downloading  [####----------------]21.19%   8.0MB/37.8MB (653.5kB/s) DeepVariant_icNF98.4c.vep.maf.synapse_download_102759043     
Downloading  [########------------]42.37%   16.0MB/37.8MB (1.3MB/s) DeepVariant_icNF98.4c.vep.maf.synapse_download_102759043     
Downloading  [############--------]57.63%   21.8MB/37.8MB (1.7MB/s) DeepVariant_icNF98.4c.vep.maf.synapse_download_102759043     
Downloading  [################----]78.81%   29.8MB/37.8MB (2.4MB/s) DeepVariant_icNF98.4c.vep.maf.synapse_download_102759043     
Downloading  [####################]100.00%   37.8MB/37.8MB (3.0MB/s) DeepVariant_icNF98.4c.vep.maf.synapse_download_102759043 Done...    
Downloading  [####----------------]20.82%   8.0MB/38.4MB (588.8kB/s) DeepVariant_icNF98.4d.vep.maf.synapse_download_102759046     
Downloading  [########------------]41.64%   16.0MB/38.4MB (1.1MB/s) DeepVariant_icNF98.4d.vep.maf.synapse_download_102759046     
Downloading  [############--------]58.36%   22.4MB/38.4MB (1.6MB/s) DeepVariant_icNF98.4d.vep.maf.synapse_download_102759046     
Downloading  [################----]79.18%   30.4MB/38.4MB (2.2MB/s) DeepVariant_icNF98.4d.vep.maf.synapse_download_102759046     
Downloading  [####################]100.00%   38.4MB/38.4MB (2.8MB/s) DeepVariant_icNF98.4d.vep.maf.synapse_download_102759046 Done...
mafs <- lapply(maf_paths, function(x){
  maftools::read.maf(x$path, rmFlags=100)
})
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 37421 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 2.006s elapsed (1.741s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 38005 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.735s elapsed (1.466s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 39115 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.795s elapsed (1.522s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 35826 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.079s elapsed (0.850s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 37896 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.649s elapsed (1.301s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 38870 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.412s elapsed (1.085s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 35027 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.000s elapsed (0.737s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 38500 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.492s elapsed (1.237s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 39704 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.536s elapsed (1.177s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 35993 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.050s elapsed (0.759s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 44103 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.265s elapsed (0.984s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 37787 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.214s elapsed (0.960s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 38156 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.174s elapsed (0.927s cpu) 
## -Reading
## -Validating
## -Removing 100 FLAG genes
## -Silent variants: 38833 
## -Summarizing
## -Processing clinical data
## --Missing clinical data
## -Finished in 1.399s elapsed (1.154s cpu)
merged_maf <- merge_mafs(mafs)
## Merging 14 MAF objects
## -Validating
## -Silent variants: 535236 
## -Summarizing
## -Processing clinical data
## -Finished in 5.778s elapsed (5.094s cpu)

2 Compare mafs

First, let’s compare the immortalized vs primary cells to see if there are any significant differentially mutated genes. There do not appear to be (lowest p-value ~0.1 and all p-values = 1 after FDR correction). With more cell lines, we might be able to detect a difference here, but with the current experiment we don’t detect any significantly differentially mutated genes.

primary_mafs <- subsetMaf(merged_maf, tsb = c("28cNF","cNF00.10a","cNF04.9a","cNF97.2a","cNF97.2b","cNF98.4c","cNF98.4d"))
## -Processing clinical data
immortalized_mafs <- subsetMaf(merged_maf, tsb = c("i28cNF","icNF00.10a","icNF04.9a","icNF97.2a","icNF97.2b","icNF98.4c","icNF98.4d"))
## -Processing clinical data
compare_mafs <- mafCompare(primary_mafs,immortalized_mafs, m1Name = "Primary", m2Name = "Immortalized", minMut = 0)

compare_mafs[1]
## $results
##       Hugo_Symbol Primary Immortalized       pval         or      ci.up
##    1:      PTPRZ1       0            5 0.02097902 0.00000000  0.6899019
##    2:        ALPG       1            5 0.10256410 0.08534283  1.3882351
##    3:     ANXA8L1       0            3 0.19230769 0.00000000  2.1669275
##    4:   FAM90A11P       0            3 0.19230769 0.00000000  2.1669275
##    5:       OR4N4       0            3 0.19230769 0.00000000  2.1669275
##   ---                                                                  
## 4233:     ZSCAN5A       1            1 1.00000000 1.00000000 91.3510967
## 4234:      ZSWIM6       4            4 1.00000000 1.00000000 13.0293597
## 4235:       ZWINT       6            6 1.00000000 1.00000000 91.3510967
## 4236:         ZYX       3            3 1.00000000 1.00000000 13.0293597
## 4237:       ZZEF1       1            1 1.00000000 1.00000000 91.3510967
##            ci.low adjPval
##    1: 0.000000000       1
##    2: 0.001222521       1
##    3: 0.000000000       1
##    4: 0.000000000       1
##    5: 0.000000000       1
##   ---                    
## 4233: 0.010946776       1
## 4234: 0.076749743       1
## 4235: 0.010946776       1
## 4236: 0.076749743       1
## 4237: 0.010946776       1

3 Plot maf summaries

Let’s plot a summary of each maf.

lapply(mafs, function(x){
       plotmafSummary(x)
  })

## [[1]]
## NULL
## 
## [[2]]
## NULL
## 
## [[3]]
## NULL
## 
## [[4]]
## NULL
## 
## [[5]]
## NULL
## 
## [[6]]
## NULL
## 
## [[7]]
## NULL
## 
## [[8]]
## NULL
## 
## [[9]]
## NULL
## 
## [[10]]
## NULL
## 
## [[11]]
## NULL
## 
## [[12]]
## NULL
## 
## [[13]]
## NULL
## 
## [[14]]
## NULL

4 Plot maf summaries

Let’s plot a summary of each cohort.

p <- plotmafSummary(primary_mafs, showBarcodes = T, textSize = 0.5)

p
## NULL
pdf('../figures/DeepVariant_primaryMafSummary.pdf')
p
## NULL
dev.off()
## quartz_off_screen 
##                 2
p <- plotmafSummary(immortalized_mafs, showBarcodes = T, textSize = 0.5)

p
## NULL
pdf('../figures/DeepVariant_immortalizedMafSummary.pdf')
p
## NULL
dev.off()
## quartz_off_screen 
##                 2

4.1 Look at NF1 variants

lollipopPlot2(primary_mafs, immortalized_mafs, gene = 'NF1',m1_label = 'all', m2_label = 'all',labPosAngle = 45, labPosSize = 0.75, domainLabelSize = 0.5, m1_name = "Primary", m2_name = "Immortalized")
##    HGNC    refseq.ID   protein.ID aa.length
## 1:  NF1    NM_000267    NP_000258      2818
## 2:  NF1 NM_001042492 NP_001035957      2839
##    HGNC    refseq.ID   protein.ID aa.length
## 1:  NF1    NM_000267    NP_000258      2818
## 2:  NF1 NM_001042492 NP_001035957      2839

pdf("../figures/DeepVariant_NF1_variants.pdf")
lollipopPlot2(primary_mafs, immortalized_mafs, gene = 'NF1',m1_label = 'all', m2_label = 'all',labPosAngle = 45, labPosSize = 0.75, domainLabelSize = 0.5, m1_name = "Primary", m2_name = "Immortalized")
##    HGNC    refseq.ID   protein.ID aa.length
## 1:  NF1    NM_000267    NP_000258      2818
## 2:  NF1 NM_001042492 NP_001035957      2839
##    HGNC    refseq.ID   protein.ID aa.length
## 1:  NF1    NM_000267    NP_000258      2818
## 2:  NF1 NM_001042492 NP_001035957      2839
dev.off()
## quartz_off_screen 
##                 2

4.2 Table of NF1 variants

merged_maf@data %>% 
  filter(Hugo_Symbol == "NF1") %>% 
  select(Tumor_Sample_Barcode, Variant_Classification, Variant_Type, 
         HGVSc, HGVSp_Short,
         dbSNP_RS, SIFT, PolyPhen, IMPACT) %>% 
  set_names(c("Cell Line", "Variant Classification", "Variant Type",
          "Genetic Change", "Protein Change", "dbSNP ID", "SIFT", "PolyPhen", "IMPACT")) %>% 
  write_csv("../figures/DeepVariant_NF1_variants.csv")

merged_maf@data %>% 
  filter(Hugo_Symbol == "NF1") %>% 
  select(Tumor_Sample_Barcode, Variant_Classification, Variant_Type, 
         HGVSc, HGVSp_Short,
         dbSNP_RS, SIFT, PolyPhen, IMPACT) %>% 
  set_names(c("Cell Line", "Variant Classification", "Variant Type",
          "Genetic Change", "Protein Change", "dbSNP ID", "SIFT", "PolyPhen", "IMPACT"))
sessionInfo()
## R version 4.2.1 (2022-06-23)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur ... 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] synapser_0.15.35 forcats_0.5.2    stringr_1.4.1    dplyr_1.0.10    
##  [5] purrr_0.3.4      readr_2.1.3      tidyr_1.2.1      tibble_3.1.8    
##  [9] ggplot2_3.3.6    tidyverse_1.3.2  maftools_2.12.0 
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.4             sass_0.4.2             bit64_4.0.5           
##  [4] vroom_1.6.0            jsonlite_1.8.2         splines_4.2.1         
##  [7] pack_0.1-1             modelr_0.1.9           bslib_0.4.0           
## [10] assertthat_0.2.1       highr_0.9              googlesheets4_1.0.1   
## [13] cellranger_1.1.0       yaml_2.3.5             pillar_1.8.1          
## [16] backports_1.4.1        lattice_0.20-45        glue_1.6.2            
## [19] digest_0.6.29          RColorBrewer_1.1-3     rvest_1.0.3           
## [22] colorspace_2.0-3       htmltools_0.5.3        Matrix_1.5-1          
## [25] pkgconfig_2.0.3        PythonEmbedInR_0.12.79 broom_1.0.1           
## [28] haven_2.5.1            scales_1.2.1           tzdb_0.3.0            
## [31] googledrive_2.0.0      generics_0.1.3         ellipsis_0.3.2        
## [34] cachem_1.0.6           withr_2.5.0            cli_3.4.1             
## [37] survival_3.4-0         magrittr_2.0.3         crayon_1.5.2          
## [40] readxl_1.4.1           evaluate_0.16          fs_1.5.2              
## [43] fansi_1.0.3            xml2_1.3.3             tools_4.2.1           
## [46] data.table_1.14.2      hms_1.1.2              gargle_1.2.1          
## [49] lifecycle_1.0.2        munsell_0.5.0          reprex_2.0.2          
## [52] compiler_4.2.1         jquerylib_0.1.4        rlang_1.0.6           
## [55] grid_4.2.1             rstudioapi_0.14        rmarkdown_2.16        
## [58] DNAcopy_1.70.0         gtable_0.3.1           codetools_0.2-18      
## [61] DBI_1.1.3              R6_2.5.1               lubridate_1.8.0       
## [64] knitr_1.40             bit_4.0.4              fastmap_1.1.0         
## [67] utf8_1.2.2             stringi_1.7.8          parallel_4.2.1        
## [70] vctrs_0.4.2            dbplyr_2.2.1           tidyselect_1.1.2      
## [73] xfun_0.33